//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.lyq.filter;

import javax.servlet.*;
import java.io.IOException;

public class CharaactorFilter implements Filter {
    String encoding = null;

    public CharaactorFilter() {
    }

    public void init(FilterConfig fConfig) throws ServletException {
        System.out.println("初始化");
        this.encoding = fConfig.getInitParameter("encoding");
    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        if (this.encoding != null) {
            request.setCharacterEncoding(this.encoding);
            response.setContentType("text/html;charset=" + this.encoding);
        }

        chain.doFilter(request, response);
    }

    public void destroy() {
        this.encoding = null;
    }
}
